﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Shop.Image.Kit
{
    /// <summary>
    /// 图片上传基类
    /// </summary>
    public abstract class BaseImage
    {
        //此处存在一个文件夹对应多个图片的问题，因此这样抽像不合适。将此处拆分时一个实体类更好。
        //string _imgFullName; 
        //string _imgName;
        //string _imgUrl;
        //int _imgWidth;
        //int _imgHeight;
        string _dirFileName="";
        string _iniSection=""; //配置INI段名
        string _iniFilePath=""; //配置上传图片空间的相关参数

        public string DirFileName
        {
            get { return _dirFileName; }
            set { _dirFileName = value; }
        }

        protected BaseImage() { }

        protected BaseImage(string iniFilePath,string iniSection,string dirFileName)
        {
            this._dirFileName = dirFileName;
            this._iniSection = iniSection;
            this._iniFilePath = iniFilePath;
        }

        protected BaseImage(string imgFullName, string imgName)
        {
        }

        /// <summary>
        /// 图片上传到指定文件夹
        /// </summary>
        /// <param name="imgFullName">本地图片的全路径</param>
        /// <param name="imgName">上传后的图片名</param>
        /// <returns>返回上传后的图片URL地址， 不成功返回 ""</returns>
        public abstract string ImageUpload(string imgFullName, string imgName);
    }
}
